﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ControllerClient
{
    class HeadHelper
    {
        public static LogicHead analysisData(byte[] data)
        {
            LogicHead lh = new LogicHead();
            //byte[] space = new byte[4];
            //Array.Copy(data, 0, space, 0, 4);
           
            byte[] length = new byte[4];
            Array.Copy(data, 0, length, 0, 4);
            byte[] sequence = new byte[8];
            Array.Copy(data, 4, sequence, 0, 8);

            byte[] transport = new byte[2];
            Array.Copy(data, 12, transport, 0, 2);
            byte[] payloads = new byte[data.Length - 14];
            Array.Copy(data, 14, payloads, 0, data.Length - 14);
            lh.length = length;
            lh.sequence = sequence;
           
            lh.transport = transport;
            lh.payloads = payloads;
            return lh;

        }
    }
}
